<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Dashboard">
    <meta name="keyword" content="Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <title>码客思</title>
    <link href="${rc.contextPath}/assets/css/bootstrap.css" rel="stylesheet">
    <link href="${rc.contextPath}/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="${rc.contextPath}/assets/css/zabuto_calendar.css">
    <link rel="stylesheet" type="text/css" href="${rc.contextPath}/assets/js/gritter/css/jquery.gritter.css" />
    <link rel="stylesheet" type="text/css" href="${rc.contextPath}/assets/lineicons/style.css">    
    <link href="${rc.contextPath}/assets/css/style.css" rel="stylesheet">
    <link href="${rc.contextPath}/assets/css/style-responsive.css" rel="stylesheet">
    <script src="${rc.contextPath}/assets/js/chart-master/Chart.js"></script>
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
   	<div class="row mt">
   		<div class="col-lg-12">
           <div class="form-panel">
           	  <h4 class="mb">系统管理 <i class="fa fa-angle-right"></i> 头像信息上传</h4>
               <form id="uploadForm" class="form-horizontal style-form" action="#">
               	    <div class="form-group">
                       <label class="col-sm-2 col-sm-2 control-label">照片</label>
                       <div class="col-sm-10">
                       <div class="controls" id="imgshow">
		                <#if bean.url??>
		                <img src="${rc.contextPath}/sysuser/download.html?id=${bean.id}" class="img-circle" width="160">
		                <#else>
		                <img src="${rc.contextPath}/assets/img/ui-sam.jpg" class="img-circle" width="160">
		                </#if>
		                </div>
                       </div>
                   </div>
                   <div class="form-group">
                       <label class="col-sm-2 col-sm-2 control-label">操作</label>
                       <div class="col-sm-10">
                          <input type='file' name='file'/>
                       </div>
                   </div>
                   <div class="form-group">
                       <label class="col-lg-2 col-sm-2 control-label"></label>
                       <div class="col-lg-10">
                           <button type="button" class="btn btn-theme" onclick="doUpload(${bean.id})">✔上传个人图片</button>
                       </div>
                   </div>
               </form>
           </div>
   		</div><!-- col-lg-12-->      	
   	</div><!-- /row -->
                 
    <script src="${rc.contextPath}/assets/js/jquery.js"></script>
    <script src="${rc.contextPath}/assets/js/jquery-1.8.3.min.js"></script>
    <!-- 验证框架 -->
	<script type="text/javascript" src="${rc.contextPath}/bootstrap/bootstrap.min.js"></script>
	<script type="text/javascript" src="${rc.contextPath}/bootstrap/bootstrap-modal.js"></script>
	<script type="text/javascript" src="${rc.contextPath}/bootstrap/bootstrap-modalmanager.js"></script>
	<script type="text/javascript" src="${rc.contextPath}/bootstrap/bootstrap-validation.js"></script>
    
    <script src="${rc.contextPath}/assets/js/bootstrap.min.js"></script>
    <script class="include" type="text/javascript" src="${rc.contextPath}/assets/js/jquery.dcjqaccordion.2.7.js"></script>
    <script src="${rc.contextPath}/assets/js/jquery.scrollTo.min.js"></script>
    <script src="${rc.contextPath}/assets/js/jquery.nicescroll.js" type="text/javascript"></script>
    <script src="${rc.contextPath}/assets/js/jquery.sparkline.js"></script>
    <script src="${rc.contextPath}/assets/js/common-scripts.js"></script>
    <script type="text/javascript" src="${rc.contextPath}/assets/js/gritter/js/jquery.gritter.js"></script>
    <script type="text/javascript" src="${rc.contextPath}/assets/js/gritter-conf.js"></script>
    <script src="${rc.contextPath}/assets/js/sparkline-chart.js"></script>    
	<script src="${rc.contextPath}/assets/js/zabuto_calendar.js"></script>	
		<!-- 弹出JS -->
	<script type="text/javascript" src="${rc.contextPath}/layer/layer.js"></script>
	<script type="text/javascript">
	//上传附件
	function doUpload(id) {  
		 var timestamp = (new Date()).valueOf();
	     var formData = new FormData($( "#uploadForm" )[0]);  
	     $.ajax({  
	          url: '${rc.contextPath}/sysuser/upload.html?id='+id+"&i="+timestamp ,  
	          type: 'POST',  
	          data: formData,  
	          async: false,  
	          cache: false,  
	          contentType: false,  
	          processData: false,  
	          success: function (returndata) {  
	        	  layer.msg(returndata);
	        	  $("#imgshow").html("<img src='${rc.contextPath}/sysuser/download.html?id="+id+"&i="+timestamp+"'class='img-circle' width='160'>");
				  layer.close(index);
	          },  
	          error: function (returndata) {  
	        	  layer.msg(returndata); 
	          }  
	     });  
	}
	</script>
  </body>
</html>
